<html><!-- Created using the cpp_pretty_printer from the dlib C++ library.  See http://dlib.net for updates. --><head><title>dlib C++ Library - detection_template_tools_abstract.h</title></head><body bgcolor='white'><pre>
<font color='#009900'>// Copyright (C) 2011  Davis E. King (davis@dlib.net)
</font><font color='#009900'>// License: Boost Software License   See LICENSE.txt for the full license.
</font><font color='#0000FF'>#undef</font> DLIB_DETECTION_TEMPlATE_TOOLS_ABSTRACT_H__
<font color='#0000FF'>#ifdef</font> DLIB_DETECTION_TEMPlATE_TOOLS_ABSTRACT_H__

<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../geometry.h.html'>../geometry.h</a>"
<font color='#0000FF'>#include</font> <font color='#5555FF'>&lt;</font>utility<font color='#5555FF'>&gt;</font>
<font color='#0000FF'>#include</font> <font color='#5555FF'>&lt;</font>vector<font color='#5555FF'>&gt;</font>

<font color='#0000FF'>namespace</font> dlib
<b>{</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    rectangle <b><a name='compute_box_dimensions'></a>compute_box_dimensions</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>double</u></font> width_to_height_ratio,
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>double</u></font> area
    <font face='Lucida Console'>)</font>;
    <font color='#009900'>/*!
        requires
            - area &gt; 0
            - width_to_height_ratio &gt; 0
        ensures
            - returns a rectangle with the given area and width_to_height_ratio.
            - In particular, returns a rectangle R such that:
                - R.area() == area (to within integer precision)
                - R.width()/R.height() == width_to_height_ratio (to within integer precision)
                - center(R) == point(0,0)
    !*/</font>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    std::vector<font color='#5555FF'>&lt;</font>rectangle<font color='#5555FF'>&gt;</font> <b><a name='create_single_box_detection_template'></a>create_single_box_detection_template</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> object_box 
    <font face='Lucida Console'>)</font>;
    <font color='#009900'>/*!
        ensures
            - returns a vector that contains only object_box.  
            - In particular, returns a vector V such that:
                - V.size() == 1
                - V[0] == object_box
    !*/</font>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    std::vector<font color='#5555FF'>&lt;</font>rectangle<font color='#5555FF'>&gt;</font> <b><a name='create_overlapped_2x2_detection_template'></a>create_overlapped_2x2_detection_template</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> object_box 
    <font face='Lucida Console'>)</font>;
    <font color='#009900'>/*!
        ensures
            - Divides object_box up into four overlapping regions, the
              top half, bottom half, left half, and right half.  These
              four rectangles are returned inside a std::vector.
            - In particular, returns a vector V such that:
                - V.size() == 4
                - V[0] == top half of object_box 
                - V[1] == bottom half of object_box 
                - V[2] == left half of object_box 
                - V[3] == right half of object_box 
                - for all valid i: object_box.contains(V[i]) == true
    !*/</font>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    std::vector<font color='#5555FF'>&lt;</font>rectangle<font color='#5555FF'>&gt;</font> <b><a name='create_grid_detection_template'></a>create_grid_detection_template</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&amp;</font> object_box,
        <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>int</u></font> cells_x,
        <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>int</u></font> cells_y
    <font face='Lucida Console'>)</font>;
    <font color='#009900'>/*!
        requires
            - cells_x &gt; 0
            - cells_y &gt; 0
        ensures
            - Divides object_box up into a grid and returns a vector 
              containing all the rectangles corresponding to elements
              of the grid.  Moreover, the grid will be cells_x elements
              wide and cells_y elements tall.
            - In particular, returns a vector V such that:
                - V.size() == cells_x*cells_y 
                - for all valid i: 
                    - object_box.contains(V[i]) == true
                    - V[i] == The rectangle corresponding to the ith grid
                      element. 
    !*/</font>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<b>}</b>


<font color='#0000FF'>#endif</font> <font color='#009900'>// DLIB_DETECTION_TEMPlATE_TOOLS_ABSTRACT_H__
</font>



</pre></body></html>